package com.tencent.wxcloudrun.controller;

import com.github.pagehelper.PageInfo;
import com.tencent.wxcloudrun.model.User;
import com.tencent.wxcloudrun.model.UserList;
import com.tencent.wxcloudrun.response.R;
import com.tencent.wxcloudrun.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * ClassName: UserController
 * Package: com.tencent.wxcloudrun.controller
 * Description:
 *
 * @Date: 2023/1/22 8:34 AM
 * @Author: wht
 */
@Slf4j
@RestController
//@RestController = @Controller + @ResponseBody
@RequestMapping("/admin")
public class UserController {
    @Autowired
    UserService userService;


    @PatchMapping("/updateOneUserById")
    public <T> R<T> updateOneUserById(@RequestBody User user) {
        userService.updateOneUserById(user);
        return R.successMsg("修改成功！");
    }

    @PostMapping("/getUserList")
    public <T> R<T> getUserList(@RequestBody User user) {
        PageInfo userList = userService.getUserList(user);
        return R.successData(userList);
    }


}
